<?php
include( "inc/header.php" );
login_check( );
if ( $_GET['Action'] == "Save" )
{
				delindexhtml( $_POST['id'], $_POST['webhtmlmode'] );
				$db->query( "update tun2_config set \r\n\tweburl='".$_POST['weburl']."',\r\n\twebname='{$_POST['webname']}',\r\n\tweblogo='{$_POST['weblogo']}',\r\n\twebmeta='{$_POST['webmeta']}',\r\n\twebintroduced='{$_POST['webintroduced']}',\r\n\ttun2key='{$_POST['tun2key']}',\r\n\ttel='{$_POST['tel']}',\r\n\ticp='{$_POST['icp']}',\r\n\twebhtmlmode='{$_POST['webhtmlmode']}',\r\n\twebhtmldir='{$_POST['webhtmldir']}',\r\n\tskindir='{$_POST['skindir']}',\r\n\tskincache='{$_POST['skincache']}',\r\n\twebhtmlname='{$_POST['webhtmlname']}',\r\n\twebdir='{$_POST['webdir']}',\r\n\tupfile='{$_POST['upfile']}',\r\n\tVersion='{$_POST['Version']}' where id={$_POST['id']}" );
				addlog( "修改网站配置", $_SESSION['user_name'] );
				admin_showerr( "<li>网站配置信息修改成功</li>", "Admin_Settings.php", 1 );
}
else
{
				$db->query( "select * from tun2_config" );
				$db->next_record( );
				echo "<script language=\"javascript\" src=\"inc/js.js\"></script>\r\n<table width=\"98%\" border=\"1\" align=\"center\" cellpadding=\"5\" cellspacing=\"0\" class=\"table\">\r\n<form action=\"Admin_Settings.php?Action=Save\" method=\"post\" onSubmit=\"return Validator.Validate(this,3)\">\r\n  <tr>\r\n   <td width=\"15%\" align=\"right\">网站域名：</td>\r\n   <td>\r\n     <input name=\"id\" type=\"hidden\" value=\"";
				echo $db->Record['id'];
				echo "\" />\r\n     <input name=\"weburl\" type=\"text\" value=\"";
				echo $db->Record['weburl'];
				echo "\" size=\"30\" dataType=\"Require\" msg=\"请填网站域名\"/>\r\n    (请使用http://标识),后面不要带&quot;/&quot;符号</td>\r\n  </tr>\r\n  <tr>\r\n    <td align=\"right\">网站名称：</td>\r\n    <td><input name=\"webname\" type=\"text\" value=\"";
				echo $db->Record['webname'];
				echo "\" size=\"30\" dataType=\"Require\" msg=\"请填网站名称\"/></td>\r\n  </tr>  \r\n  <tr>\r\n    <td align=\"right\">网站Logo：</td>\r\n    <td><input name=\"weblogo\" type=\"text\" value=\"";
				echo $db->Record['weblogo'];
				echo "\" size=\"30\" dataType=\"Require\" msg=\"请填网站名称\"/></td>\r\n  </tr>  \r\n  <tr>\r\n    <td align=\"right\">网站关键字：</td>\r\n    <td><textarea name=\"webmeta\" cols=\"45\" rows=\"5\">";
				echo $db->Record['webmeta'];
				echo "</textarea> \r\n      关键字间用英文的逗号隔开,设置后易被搜索引擎收录</td>\r\n  </tr>\r\n  <tr>\r\n    <td align=\"right\">网站介绍：</td>\r\n    <td>\r\n    <textarea name=\"webintroduced\" cols=\"45\" rows=\"5\">";
				echo $db->Record['webintroduced'];
				echo "</textarea></td>\r\n  </tr>\r\n  <tr>\r\n    <td align=\"right\">系统安装目录：</td>\r\n    <td><input name=\"webdir\" type=\"text\" value=\"";
				echo $db->Record['webdir'];
				echo "\" size=\"30\" dataType=\"Require\" msg=\"请填系统安装目录\"/></td>\r\n  </tr>\r\n  <tr>\r\n    <td align=\"right\">模板存放目录：</td>\r\n    <td><input name=\"skindir\" type=\"text\" value=\"";
				echo $db->Record['skindir'];
				echo "\" size=\"30\" dataType=\"Require\" msg=\"请填模板存放目录\"/>*模板存于templates文件夹下</td>\r\n  </tr>\r\n  <tr>\r\n    <td align=\"right\">模板缓存生成时间：</td>\r\n    <td><input name=\"skincache\" type=\"text\" value=\"";
				echo $db->Record['skincache'];
				echo "\" size=\"30\" dataType=\"Require\" msg=\"请填模板缓存生成时间\"/>*模板修改后时间内刷新(以秒为单位)，0为不缓存</td>\r\n  </tr>\r\n  <tr>\r\n    <td align=\"right\">图片上传目录：</td>\r\n    <td><input name=\"upfile\" type=\"text\" value=\"";
				echo $db->Record['upfile'];
				echo "\" size=\"30\" dataType=\"Require\" msg=\"请填图片上传目录\"/></td>\r\n  </tr>\r\n  <tr style=\"display:none;\">\r\n    <td align=\"right\">站点生成模式：</td>\r\n    <td>\r\n    <select name=\"webhtmlmode\">\r\n      <option value=\"php\" ";
				if ( $db->Record['webhtmlmode'] == "php" )
				{
								echo "selected";
				}
				echo ">php&nbsp;动态模式</option>\r\n      <option value=\"htm\" ";
				if ( $db->Record['webhtmlmode'] == "htm" )
				{
								echo "selected";
				}
				echo ">htm&nbsp;静态模式</option>\r\n\t  <option value=\"html\" ";
				if ( $db->Record['webhtmlmode'] == "html" )
				{
								echo "selected";
				}
				echo ">html&nbsp;静态模式</option>\r\n\t  <option value=\"shtm\" ";
				if ( $db->Record['webhtmlmode'] == "shtm" )
				{
								echo "selected";
				}
				echo ">shtm&nbsp;静态模式</option>\r\n\t  <option value=\"shtml\" ";
				if ( $db->Record['webhtmlmode'] == "shtml" )
				{
								echo "selected";
				}
				echo ">shtml&nbsp;静态模式</option>\r\n    </select></td>\r\n  </tr>\r\n  <tr style=\"display:none;\">\r\n    <td align=\"right\">生成目录：</td>\r\n    <td><input name=\"webhtmldir\" type=\"text\" value=\"";
				echo $db->Record['webhtmldir'];
				echo "\" size=\"30\" dataType=\"Require\" msg=\"请填生成目录\"/></td>\r\n  </tr>\r\n  <tr style=\"display:none;\">\r\n    <td align=\"right\">生成方式：</td>\r\n    <td>\r\n\t<select name=\"webhtmlname\" onChange=\"ChooseDate(this.value);\">\r\n      <option value=\"1\" ";
				if ( $db->Record['webhtmlname'] == 1 )
				{
								echo "selected";
				}
				echo ">按ID生成文档名称</option>\r\n      <option value=\"2\" ";
				if ( $db->Record['webhtmlname'] == 2 )
				{
								echo "selected";
				}
				echo ">按时间生成文档名称</option>\r\n\t  <option value=\"3\" ";
				if ( $db->Record['webhtmlname'] == 3 )
				{
								echo "selected";
				}
				echo ">按目录生成文档名称</option>\r\n    </select> <span id=\"sohwhtmlname\"></span>\r\n\t</td>\r\n  </tr>\r\n  <tr>\r\n    <td align=\"right\">系统版本号：</td>\r\n    <td><input name=\"Version\" type=\"text\" value=\"";
				echo $db->Record['Version'];
				echo "\" size=\"30\" dataType=\"Require\" msg=\"请填系统版本号\"/></td>\r\n  </tr>\r\n  <tr>\r\n    <td align=\"right\">ICP备案信息：</td>\r\n    <td>\r\n    <textarea name=\"icp\" cols=\"45\" rows=\"2\">";
				echo $db->Record['icp'];
				echo "</textarea></td>\r\n  </tr>\r\n    <tr>\r\n    <td align=\"right\">授权号：</td>\r\n    <td>\r\n<input name=\"tun2key\" type=\"text\" value=\"";
				echo $db->Record['tun2key'];
				echo "\" size=\"30\" /></td>\r\n  </tr>\r\n  <tr>\r\n    <td align=\"right\">联系电话：</td>\r\n    <td>\r\n        <input name=\"tel\" type=\"text\" value=\"";
				echo $db->Record['tel'];
				echo "\" size=\"30\" />    </td>\r\n  </tr>\r\n  <tr>\r\n    <td colspan=\"2\" align=\"center\"><input type=\"submit\" name=\"button\" id=\"button\" value=\"更新网站设置\" /></td>\r\n  </tr>\r\n  </form>\r\n</table>\r\n";
}
echo "<script language=\"JavaScript\">\r\nChooseDate(\"";
echo $db->Record['webhtmlname'];
echo "\");\r\nfunction ChooseDate(DateStr)\r\n{ \r\n\tswitch (DateStr) \r\n\t{\r\n\t\tcase \"1\":\r\n\t\t\tdocument.getElementById('sohwhtmlname').innerHTML=\"html/view_20.html\";\r\n\t\tbreak;\r\n\t\t\r\n\t\tcase \"2\":\r\n\t\t\tdocument.getElementById('sohwhtmlname').innerHTML=\"html/200805140000.html\";\r\n\t\tbreak;\r\n\t\t\r\n\t\tcase \"3\":\r\n\t\t\tdocument.getElementById('sohwhtmlname').innerHTML=\"html/20/\";\r\n\t\tbreak;\r\n\t\t}\r\n}\r\n</script>\r\n</body>\r\n</html>";
?>
